import time
from appium.webdriver.common.mobileby import MobileBy
from app_study.app_snowball_po.base.snowball_app import SnowballApp


class MainPage(SnowballApp):

    _SEARCH_BOX_ELEMENT = (MobileBy.ID, "com.xueqiu.android:id/home_search")

    def click_search(self):
        # 创建弹窗
        self.find_and_click(MobileBy.ID, "com.xueqiu.android:id/post_status")
        # self.find_and_click(MobileBy.ID, "com.xueqiu.android:id/iv_action_back")
        time.sleep(2)
        # click searchbox 搜索框
        self.find_and_click(*self._SEARCH_BOX_ELEMENT)

        from app_study.app_snowball_po.page.search_page import SearchPage
        return SearchPage(self.driver)